// DlgPropClose.cpp : implementation file
//

#include "stdafx.h"
#include "XIE.h"
#include "DlgPropClose.h"


// CDlgPropClose dialog

IMPLEMENT_DYNAMIC(CDlgPropClose, CDialog)

CDlgPropClose::CDlgPropClose(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgPropClose::IDD, pParent)
	, m_bSaveAction(FALSE)
{
	m_nSelectStatus = 0;
}

CDlgPropClose::~CDlgPropClose()
{
}

void CDlgPropClose::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_STATIC_TEXT, m_wndPropText);
	DDX_Check(pDX, IDC_SAVEACTION, m_bSaveAction);
}


BEGIN_MESSAGE_MAP(CDlgPropClose, CDialog)	
	
	ON_BN_CLICKED(IDC_CLOSE_ACTIVE, &CDlgPropClose::OnBnClickedCloseActive)
END_MESSAGE_MAP()


// CDlgPropClose message handlers

void CDlgPropClose::OnOK()
{
	// TODO: Add your specialized code here and/or call the base class
	m_nSelectStatus = 1;
	UpdateData();
	AfxGetApp()->WriteProfileInt(_T("Settings"), _T("AutoExit"), m_bSaveAction);
	CDialog::OnOK();
}

void CDlgPropClose::OnCancel()
{
	// TODO: Add your specialized code here and/or call the base class
	m_nSelectStatus = 0;
	CDialog::OnCancel();
}


BOOL CDlgPropClose::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  Add extra initialization here

	m_wndPropText.SetFont(GetFont());

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}


void CDlgPropClose::OnBnClickedCloseActive()
{
	// TODO: Add your control notification handler code here
	m_nSelectStatus = 2;
	CDialog::OnOK();
}

INT_PTR CDlgPropClose::DoModal()
{
	// TODO: Add your specialized code here and/or call the base class

	m_bSaveAction = AfxGetApp()->GetProfileInt(_T("Settings"), _T("AutoExit"), 0);

	if (m_bSaveAction)
	{
		m_nSelectStatus = 1;
		return IDOK;
	}

	return CDialog::DoModal();
}
